<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
       <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/finance">财务管理</a></li>
          <li class="active">学员档案</li>
        </ol>
      </div>
    
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
      
        <div class="col-xs-10 x-panel-layout-right">
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>学员档案&nbsp;-&nbsp;学员列表</span></h2>
            </div>
            
            <div class="x-breadcrumb-wrapper top-margin-20" style="position: relative;">
              <ul class="nav nav-pills x-breadcrumb-nav">
                <li class="pull-left ${paid ? 'active' : ''}"><a href="${ctx.host}/sales-orders?paid=true">已支付</a></li>
                <li class="pull-left ${!paid ? 'active' : ''}"><a href="${ctx.host}/sales-orders?paid=false">未支付</a></li>
              </ul>
            </div>
            
            <div class="x-breadcrumb-wrapper clearfix" style="position: relative; margin-top: 15px;">
                <div class="btn-group pull-left">
                  <a href="${ctx.host}/sales-orders?paid=${paid}&export=false"  class="btn btn-${export ? 'default' : 'success'} x-btn btn-shadow btn-shadow-${export ? 'default' : 'success'} ">
                    &nbsp;&nbsp;未导出
                  </a>
                </div>
                <div class="btn-group pull-left">
                  <a href="${ctx.host}/sales-orders?paid=${paid}&export=true" class="btn btn-${export ? 'success' : 'default'} x-btn btn-shadow btn-shadow-${export ? 'success' : 'default'}">
                    &nbsp;&nbsp;已导出
                  </a>
                </div>
                <div class="btn-group pull-right">
                  <c:if test="${!export}">
                    <a href="${ctx.host}/sales-orders/export-view?paid=${paid}" data-target="#sales-export" data-toggle="modal" title="导出数据" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                      <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;导出数据
                    </a>
                  </c:if>
                </div>
              </div>
            
          </div>
          
          <table class="table table-striped table-hover x-table bottom-margin-20">
            <thead>
              <tr>
                <th>订单号</th>
                <th>订单日期</th>
                <th>业务类型</th>
                <th>销售类型编号</th>
                <th>客户编码</th>
                <th>客户名称</th>
                <th>业务员编码</th>
                <th>币种</th>
                <th>表头税率</th>
                <th>制单人</th>
                <th>存货编码</th>
                <th>价税合计</th>
              </tr>
            </thead>
            <tbody>
              <c:forEach var="order" items="${orders}">
                <tr>
                  <td>${order.code}</td>
                  <td><fmt:formatDate value = "${order.createTime}" pattern="yyyy/MM/dd"/></td>
                  <td>普通销售</td>
                  <td>${(order.orderType.online || order.orderType.activity) ? (order.course.experience ? '12' : '11') : (order.orderType.offline ?  (order.course.experience ? '23' : (order.course.year ? '22' : (order.orderType.individual ? '21' : ''))) : '3')}</td>
                  <td>RMJU0${order.user.id}</td>
                  <td>${order.student.name}</td>
                  <td>${order.orderType.offline ? order.salesman.financeCode : order.orderType.online ? '017' : '054'}</td>
                  <td>人民币</td>
                  <td>0</td>
                  <td>${order.orderType.offline ? persist.siteManager(order.site.id).name : 'JIM'}</td>
                  <td>${order.product.type.online ? 'RMJZXS' : order.product.type.offline ? 'RMJZXX' : 'RMJZDS'}${order.product.id}</td>
                  <td>${order.price/100}</td>
                </tr>
              </c:forEach>
            </tbody>
          </table>
          
          <div class="form-horizontal clearfix">
            
          <jsp:include page="/WEB-INF/include/page.jsp">
            <jsp:param name="url" value="sales-orders" />
            <jsp:param name="queryString" value="${queryString}" />
          </jsp:include>
          
          </div>
          
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/finance/sales-order-list.js">
    <script type="text/javascript">
      require(['page/finance/sales-order-list'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
</body>
</html>